<?php

use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateUsersTable extends Migration {

	/**
	 * Run the migrations.
	 *
	 * @return void
	 */
	public function up()
	{
		Schema::create('users', function(Blueprint $table)
		{
			$table->engine = 'InnoDB';
			$table->increments('id');
			$table->string('username',20)->default('')->unique();
			$table->string('nickname',20)->default('');
			$table->string('email',50)->default('')->unique();
			$table->string('password')->default('');
			$table->boolean('is_admin')->default(0);
			$table->boolean('is_block')->default(0);
			$table->rememberToken();
			//性别，保密为0，男为1，女为2，默认为0
			$table->tinyInteger('gender')->default(0)->unsigned();
			//修改签名
			$table->string('signature')->default('');
			//出生年月日
			$table->string('birth_date',20)->default('1988-08-08');
			//居住省市县（区 ）
			$table->string('province',20)->default('广西');
			$table->string('city',20)->default('南宁市');
			$table->string('county',20)->default('青秀区');
			//邮件通知
			$table->boolean('notify')->default(0);
			//每周邮件订阅
			$table->boolean('weekly_report')->default(0);
			//三种用户头像尺寸
			$table->string('avatar_b')->default('uploads/avatar/default.png');
			$table->string('avatar_m')->default('uploads/avatar/default.png');
			$table->string('avatar_s')->default('uploads/avatar/default.png');
			//记录注册登录相关信息
			$table->string('register_ip')->default('0.0.0.0');
			$table->string('login_last_ip')->default('0.0.0.0');
			$table->timestamps();
		});
	}

	/**
	 * Reverse the migrations.
	 *
	 * @return void
	 */
	public function down()
	{
		Schema::drop('users');
	}

}
